package com.cskaoyan.order.api;

import com.alibaba.druid.sql.ast.expr.SQLCaseExpr;
import com.cskaoyan.mall.commons.result.ServiceCallResponse;
import com.cskaoyan.mall.commons.result.ServiceCallResponseUtil;
import com.cskaoyan.order.dal.entitys.OrderItem;
import com.cskaoyan.order.dal.persistence.OrderItemMapper;
import com.cskaoyan.order.service.OrderPayService;
import jdk.nashorn.internal.ir.ReturnNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author: 杨庆
 * @since: 2022.9.24 17:20
 * @description:
 */
@RestController
public class PayServiceImpl {
    @Autowired
    OrderPayService orderPayService;
    @Autowired
    OrderItemMapper orderItemMapper;

    @PutMapping(value = "/rpc/pay/success")
    ServiceCallResponse payOrderSuccess(@RequestParam("orderId") String orderId){
        // 2. 修改订单的状态 ——> 已支付
        // 3. 查询出订单中的所有商品条目，根据每一个商品条目下单的数量，扣减商品的锁定库存
        orderPayService.paySuccesssHandler(orderId);
        return new ServiceCallResponseUtil<>().ok(null);
    }
}
